<!-- target: foodCouponForm(master = formPage) -->
<!-- block: crumb -->
    <!-- import: foodCouponFormCrumb -->
<!-- /block -->
<!-- block: formMain -->
    <!-- import: foodCouponFormMain -->
<!-- /block -->

<!-- target: foodCouponFormCrumb(master = crumb) -->
<!-- block: path -->
    <span>优惠</span>
    <span><!-- if: ${formType} === 'create' -->新增<!-- else: -->编辑<!-- /if -->优惠</span>
<!-- /block -->

<!-- target: foodCouponFormMain(master = customFormView) -->
<!-- block: sections -->
    <!-- import: foodCouponBaseContent -->
<!-- /block -->
<!-- block: submitSection -->
<button type="submit" data-ui-type="Button" data-ui-id="submit" data-ui-group="submit" data-ui-variants="warning wide" class="submit-button">确认提交</button>
<!-- /block -->

<!-- target: foodCouponBaseContent -->
<section class="form-section">

    <div class="ui-form-row">
        <!-- use:
            textboxField(
                field = 'title',
                title = '优惠主题',
                width = 300,
                required = true
            )
        -->
    </div>

    <div class="ui-form-row">
        <!-- use:
            timeField(
                dateField = 'startDate1', timeField = 'startTime1',
                title = '开始时间', required = true, timeList = ${timeList}
            )
        -->
    </div>

    <div class="ui-form-row">
        <!-- use:
            timeField(
                dateField = 'endDate1', timeField = 'endTime1',
                title = '结束时间', required = true, timeList = ${timeList}
            )
        -->
    </div>

    <div class="ui-form-row">
        <!-- use:
            foodCouponTypes(
                title = '优惠类型',
                field = 'type',
                radioTab = true,
                types = ${couponTypes},
                system = ${system}
            )
        -->
    </div>

    <!-- use:
        commonTip(
            system = ${system},
            hasSpecialTimeSpan = true,
            hasBookInfo = true,
            hasTip = true,
            hasInvoiceTip = true,
            hasSpecialTip = true
        )
    -->

</section>

<!-- // 团购、折扣、抵用券 -->
<!-- target: foodCouponTypes(master = formLabelBoxGroupField) -->
<!-- block: radioGroup -->
    <!-- for: ${types} as ${item}, ${index} -->
    <div>
        <input type="radio" id="${field}-${item.value}" name="${name}" value="${item.value}">
        <label for="${field}-${item.value}">${item.text}</label>
    </div>
    <!-- /for -->
<!-- /block -->

<!-- block: content -->
<!-- for: ${types} as ${item}, ${index} -->
<!-- // 团购 -->
<!-- if: ${item.value} === '1' -->
<div id="${id | dasherize}-panel-${index}">
    <div class="ui-radiotab-panel">
        <!-- use:
            commonPrice(
                system = ${system},
                priceField = 'groupon.price',
                oldPriceField = 'groupon.oldPrice',
                hasUnit = true,
                unitField = 'groupon.unit',
                countField = 'groupon.count'
            )
        -->
    </div>
    <div class="ui-form-row food-repeator">
        <!-- use:
            couponFood(
                id = 'groupon-content',
                field = 'groupon.content',
                label = '菜品列表',
                width = 800,
                height = 420
            )
        -->
    </div>
</div>
<!-- /if -->

<!-- // 折扣 -->
<!-- if: ${item.value} === '2' -->
<div id="${id | dasherize}-panel-${index}">
    <div class="ui-radiotab-panel">
        <!-- use:
            commonPrice(
                system = ${system},
                priceField = 'discount.price',
                oldPriceField = 'discount.oldPrice'
            )
        -->
    </div>
</div>
<!-- /if -->

<!-- // 抵用券 -->
<!-- if: ${item.value} === '3' -->
<div id="${id | dasherize}-panel-${index}">
    <div class="ui-radiotab-panel">
        <!-- use:
            commonPrice(
                system = ${system},
                priceField = 'voucher.price',
                oldPriceField = 'voucher.oldPrice',
                oldPriceLabel = '抵扣'
            )
        -->
    </div>
</div>
<!-- /if -->
<!-- /for -->
<!-- /block -->

<!-- // 团购菜品列表 -->
<!-- target: couponFood(master = formLabelValueField) -->
<!-- block: value -->
<!-- var: name = ${name} || ${field} -->
<!-- var: id = ${id} || ${name} -->
<esui-control-repeater
    data-ui-id="${id}"
    data-ui-name="${name}"
    data-ui-raw-value="@${field}"
    data-ui-width="500"
>
<script type="esui-template">
    <div class="ui-form-row">
        <div class="ui-form-value">
            <label class="ml10 mr10">菜品名:</label>
            <!-- use:
                textbox(
                    width = '100',
                    childName = 'name',
                    required = true,
                    requiredErrorMessage = '请填写菜品名'
                )
            -->
            <label class="ml10 mr10">数量:</label>
            <!-- use:
                textbox(
                    width = '60',
                    childName = 'count',
                    required = true,
                    requiredErrorMessage = '请填写菜品数量'
                )
            -->
        </div>
        <span class="ui-icon-remove" data-role="remove" style="cursor:pointer;color:#EA0404;"></span>
    </div>
</script>
</esui-control-repeater>
<!-- /block -->
